package com.yf.user.domain;

import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;

import java.util.Date;

@Data
public class DrMemberBank {

    private Integer id;

    private Integer uid;

    private String bankNum;

    private String bankName;

    private String mobilePhone;//预留手机号码
    /**
     * 银行卡类型0-网银 1认证
     */
    private Integer type;

    /**
     * 状态1通过 9删除  
     */
    private Integer status;

    /**
     * 冲值渠道 0 PC 1iOS 2android 3微信 4 后台
     */
    private Integer channel;
    
    /**
     * 入库时间  
     */
    private Date addTime;

    private Integer cardFlag;//0-对私 1-对公
    
    private Integer addUser;//添加人
    
    private String agreementNo;//协议号

	private String cityId;//开户行地区代码

	private String parentBankId;//开户行行别

	private String serialNumber; //开户流水号

	private Integer createAccountStatus;//认证状态 0认证失败 1认证成功

	private String failureReason;//失败原因

	private String cashWay;//提现T0,T1

    public String getAsteriskBankNum(){
        if (StringUtils.isEmpty(bankNum)){
            return StringUtils.EMPTY;
        }
        String last4Str = bankNum.substring(bankNum.length() - 4, bankNum.length());
        String frist4Str = bankNum.substring(0, 3);
        int j = bankNum.length() - 7;
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0; i < j; i++){
            stringBuilder.append("*");
        }
        return frist4Str + stringBuilder+ last4Str;
    }


    @Getter
    public enum CashWayEnum{
        T1,T0
    }

    public boolean isT1(){
        return CashWayEnum.T1.name().equals(cashWay);
    }

}